/*
==================================
Party System
==================================

There are always at most N parties, where N is the number of
players currently in the game. When a player joins the game,
he is flagged "partiless", and as such a new party is automatically
assigned to him (in the form of "Player's Party"). This makes joining
parties easier, as the party is already made and there already is
a party admin.

Parties only contain players at the lowest level; to find ALL party members
(including monsters and other spawned things), you'll have to also loop
through the players spawned entity lists.

Monster semantics relating to losing enemies and all that still apply -
read the Enemy file for more info about how to handle changes to parties.
*/

struct CharacterData;

struct PlayerLinkedListNode
{
	CharacterData			*Data;
	
	PlayerLinkedListNode	*Next;
};

struct Party
{
	PlayerLinkedListNode	*Characters;
	int						PlayerCount;
	char					*Name;	// UID that can be assigned to parties for joining.
									// String is always a copy.

	Party					*Next;
};

// Get the first party
const Party *GetPartyHead();

// Find a party by its UID
const Party *FindParty(const char *uid);

// Create a new party
Party *CreateParty(const char *uid);

// Delete an existing party and reallocate any players in it
void DeleteParty(Party *party);

// Add a player to an existing party
void AddPlayerToParty(CharacterData *player, const Party *party);

// Remove player from his party
void RemovePlayerFromParty(CharacterData *player);

// Check if a player is partiless; if so, create one for him.
void CheckPartilessPlayer(CharacterData *player);